package Basic.day03;

public class OperDemo04 {
    public static void main(String[] args) {
        short s = 5;
//        s = s + 10;//编译错误，s+10的结果为int，无法存入s(short)，需要强转
        s += 10;//+=会自动强转，该语句等价于s=(short)(s+10)
        System.out.println(s);
        String str  = "hello";
        Class<? extends String> strClass = str.getClass();
        System.out.println("str的数据类型为："+strClass.getName());

        Integer num = 10;//①自动装箱
        Integer num1 = Integer.valueOf(10); //与①自动装箱等价

        int num2 = num;//②自动拆箱
        int num3 = num.intValue();//与②自动拆箱等价
        int num4 = 10;
        Integer num4Integer = Integer.valueOf(num4);//手动装箱
        String name = num4Integer.getClass().getName();
        System.out.println("num4Integer的数据类型为："+name);
        Integer b = null;
        int b1 = b;//编译错误，空指针异常
        System.out.println("b=" + b);//编译错误，空指针异常

        int a = 10;
        System.out.println("age=" + a);
        System.out.println("拼接后的数据类型为："+ ("age=" + a).getClass().getName());

    }
}
